<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>考试管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/teach/teachExam/">考试管理列表</a></li>
		<%--<shiro:hasPermission name="teach:teachExam:edit"><li><a href="${ctx}/teach/teachExam/form">考试管理添加</a></li></shiro:hasPermission>--%>
	</ul>
	<form:form id="searchForm" modelAttribute="teachExam" action="${ctx}/teach/teachExam/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<%--<input id="ifcheckedAn" name="ifcheckedAn" type="hidden" value="${ifcheckedAn}"/>--%>
		<ul class="ul-form">
			<li><label>科目名称：</label>
				<form:input path="examName" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>开始时间：</label>
				<input name="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${teachExam.beginDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>结束时间：</label>
				<input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${teachExam.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<%--<li><label>考试状态：</label>--%>
				<%--<form:select path="examStatus" class="input-medium">--%>
					<%--<form:option value="" label=""/>--%>
					<%--<form:options items="${fns:getDictList('exam_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
				<%--</form:select>--%>
			<%--</li>--%>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>考试科目名称</th>
				<th>考试开始时间</th>
				<th>考试结束时间</th>
				<th>考试状态</th>
				<th>可参加考试次数</th>
				<th>是否可以查看答题情况</th>
                <th>学生考试成绩</th>
				<th>更新时间</th>
				<th>备注信息</th>
				<shiro:hasPermission name="teach:teachExam:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="teachExam">
			<%
				java.util.Date dt = new Date();
				long nowTime = dt.getTime();   //得到秒数，Date类型的getTime()返回毫秒数
				request.setAttribute("nowTime", nowTime);
			%>
			<tr>
				<td><a href="${ctx}/teach/teachExam/form?id=${teachExam.id}">
					${teachExam.examName}
                </a>
                </td>
				<td>
					<fmt:formatDate value="${teachExam.beginDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${teachExam.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<c:if test="${(nowTime-teachExam.endDate.getTime())>0}">
						已结束
					</c:if>
					<c:if test="${(teachExam.beginDate.getTime()-nowTime)>0}">
						未开始
					</c:if>
					<c:if test="${(nowTime-teachExam.endDate.getTime())<0&&(teachExam.beginDate.getTime()-nowTime)<0}">
						进行中
					</c:if>
					<%--${fns:getDictLabel(teachExam.examStatus, 'exam_status', '')}--%>
				</td>
				<td>
					${teachExam.examFrequency}
				</td>
				<td>
					<%--${ifcheckedAn}--%>
						<c:if test="${teachExam.ifCheckAnswer==1}">
							是
						</c:if>
						<c:if test="${teachExam.ifCheckAnswer==0}">
							否
						</c:if>
						<c:if test="${teachExam.ifCheckAnswer!=0&&teachExam.ifCheckAnswer!=1}">
							未设置
						</c:if>

                </td>
                <td>
                    <a href="${ctx}/teach/teachExam/stuScorelist?id=${teachExam.id}">查看学生考试成绩</a>
                </td>
				<td>
					<fmt:formatDate value="${teachExam.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${teachExam.remarks}
				</td>
				<shiro:hasPermission name="teach:teachExam:edit"><td>
					<a href="${ctx}/teach/teachExam/form?id=${teachExam.id}">修改</a>
					<a href="${ctx}/teach/teachExam/detail?id=${teachExam.id}">查看详情</a>
					<%--<a href="#">查看考试详情</a>--%>
					<a href="${ctx}/teach/teachExam/delete?id=${teachExam.id}" onclick="return confirmx('确认要删除该考试管理吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>